﻿using System;

namespace Gonte
{
    /// <summary>
    /// The named object
    /// </summary>
    public class NamedObject
        : IComparable
    {
        #region Properties

        /// <summary>
        /// The name of the object
        /// </summary>
        public string Name
        {
            get { return name_; }
            set { name_ = value; }
        }

        #endregion

        #region Fields

        private string name_;

        #endregion

        #region IComparable Members

        public int CompareTo(Object @object)
        {
            NamedObject obj = @object as NamedObject;
            if (obj != null)
            {
                return name_.CompareTo(obj.name_);
            }

            throw new InvalidCastException("Object must be of type: NamedObject");
        }

        #endregion
    }
}
